<?php

namespace app\index\controller;

use thinkct\controller\Frontend;

class Index extends Frontend
{
    protected array $noNeedLogin = ['*'];

    public function index(): string
    {
        // 检查数据库是否连接
        try {
            \think\facade\Db::connect();
        } catch (\Exception $e) {
            return '数据库连接失败，请检查数据库配置';
        }

        $rootPath = $_SERVER['DOCUMENT_ROOT'] . DIRECTORY_SEPARATOR;
        if (is_file($rootPath . 'index.html')) {
            require $rootPath . 'index.html';
            die;
        }else{
            return 'Hello,world!';
        }
    }
}